<?php $this->headScript()
      ->prependFile($this->baseUrl() . '/application/modules/Exam/externals/scripts/test.js')
?> 
<div class="headline">
    <h2>
        <?php echo $this->translate('Exams');?>
    </h2>
    <div class="tabs">
        <?php
        // Render the menu
        echo $this->navigation()
        ->menu()
        ->setContainer($this->navigation)
        ->render();
        ?>
    </div>
</div>
<?php $exam = $this->exam;?>
<div class="">
	<div class="exam_info_question">
		<div class="exams_photo">
            <?php echo $this->htmlLink($exam->getHref(), $this->itemPhoto($exam, 'thumb.normal')) ?>
        </div>
        <div class="exams_info">
            <div class="exams_title">
              <h3><?php echo $this->htmlLink($exam->getHref(), $exam->getTitle()) ?></h3>
            </div>
		    <div class="exams_members">
		      <?php echo $this->locale()->toDateTime($exam->creation_date) ?>
		    </div>
            <div class="exams_members">
              <?php echo $this->translate('Post by') ?>
              <?php echo $this->htmlLink($exam->getOwner()->getHref(), $exam->getOwner()->getTitle()) ?>
            </div>
            <div class="exams_desc">
              <?php echo $exam->getDescription() ?>
            </div>
         </div>
	</div>
	<div class="clear" style="clear: both;"></div>
	<br/>
	<div class="exam_info_question_options">
		<a class="smoothbox buttonlink icon_add_new_question" href="<?php echo $this->url(array('action' => 'add-new-question', 'exam_id' => $exam->exam_id), 'exam_specific', true)?>"><?php echo $this->translate('Add new question')?></a>
		<a class="smoothbox buttonlink icon_add_exist_question" href="<?php echo $this->url(array('action' => 'add-exist-question', 'exam_id' => $exam->exam_id), 'exam_specific', true)?>"><?php echo $this->translate('Add exist question')?></a>
	</div>
	
	<div class="exam_list_questions" id="exam_list_questions">
		<?php
			//$question = $this->Question();
			//$question->setExam($this->exam);
			//echo $question->render();
		?>
	</div>
</div>
<script type="text/javascript">
	var loadQuestions = function(exam_id){
		en4.core.request.send(new Request.HTML({
		  url : en4.core.baseUrl + 'exams/exam/load-questions',
		  data : {
			format : 'html',
			exam_id : exam_id
		  }
		}), {
		  'element' : $('exam_list_questions')
		});
	}
	loadQuestions(<?php echo $this->exam->getIdentity()?>);
</script>